package com.study.system.eduadservice.controller;

import com.study.system.eduadservice.entity.PromotionAd;
import com.study.system.eduadservice.service.PromotionAdService;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 广告控制器
 */
@RestController
@RequestMapping("ad")
public class PromotionAdController {

    @Resource
    private PromotionAdService adService;

    @GetMapping("getAdsBySpaceId/{spaceid}")
    public ResponseEntity<List<PromotionAd>> getAdsBySpaceId(@PathVariable("spaceid") Integer sid){
        List<PromotionAd> list = adService.getPromotionAdsBySpaceId(sid);
        return ResponseEntity.ok(list);
    }
}
